'use strict'

const WebSocket = require('ws');

let length = 0;

let tt = setInterval(() => {

for(let i=0;i<1000;i++){
  length ++;
  const ws = new WebSocket('ws://127.0.0.1:7890/notice?id=' + i);
  ws.on('open', function open() {
    ws.send('something');
  });

  ws.on('message', function incoming(data) {
    //console.log('client : ' + data);
  });

  // setTimeout(() => {
  //   ws.close();
  //   length --;
  // }, 10000 + i * 10);
}
console.log('length: ' + length);
}, 1000);

setTimeout(() => {
  clearInterval(tt);
}, 17000)